/*      */ package com.qmsk.business.bussBill.pbPaid;
/*      */ 
/*      */ import com.qmsk.business.bussBill.bussBill.dao.BussBillDao;
/*      */ import com.qmsk.business.member.custSMS.bean.CustMessage;
/*      */ import com.qmsk.business.member.custSMS.bean.ParserSmsStateXml;
/*      */ import com.qmsk.business.member.custSMS.bean.SmsState;
/*      */ import com.qmsk.business.member.custSMS.dao.CustSMSDao;
/*      */ import com.qmsk.business.member.member.dao.MemberDAO;
/*      */ import com.qmsk.business.member.memberAct.MemberActConst;
/*      */ import com.qmsk.business.member.memberCashCoupBill.dao.MemberCashCouponBillDao;
/*      */ import com.qmsk.business.member.memberCashCoupConsumeRecord.dao.MemberCashCouponConsumeRecordDAO;
/*      */ import com.qmsk.business.member.memberCashCoupDetail.dao.MemberCashCouponDetailDAO;
/*      */ import com.qmsk.business.member.memberDepositConsumeRecord.dao.MemberDepositConsumeRecordDAO;
/*      */ import com.qmsk.business.member.memberIntegralBill.dao.MemberIntegralBillDao;
/*      */ import com.qmsk.business.member.memberIntegralConsumeRecord.dao.MemberIntegralConsumeRecordDAO;
/*      */ import com.qmsk.business.member.memberIntegralDetail.dao.MemberIntegralDetailDAO;
/*      */ import com.qmsk.business.member.memberLog.dao.MemberLogDAO;
/*      */ import com.qmsk.business.member.memberdepositbill.dao.MemberDepositBillDAO;
/*      */ import com.qmsk.business.member.shopMember.dao.ShopMemberDAO;
/*      */ import com.qmsk.business.shopList.ShopInfo;
/*      */ import com.qmsk.business.shopList.ShopMap;
/*      */ import com.qmsk.business.store.salebill.dao.SaleBillDao;
/*      */ import com.qmsk.business.store.salebill.params.SaleBillModel;
/*      */ import com.qmsk.session.bean.CSessionUser;
/*      */ import com.utils.basic.ObjectComm;
/*      */ import com.utils.gson.in.GsonHeadManyRows;
/*      */ import com.utils.gson.in.GsonHeadOneRow;
/*      */ import com.utils.http.HttpUtils;
/*      */ import com.utils.web.ResponseUtils;
/*      */ import java.io.IOException;
/*      */ import java.io.UnsupportedEncodingException;
/*      */ import java.math.BigDecimal;
/*      */ import java.sql.SQLException;
/*      */ import java.util.Map;
/*      */ import javax.servlet.http.HttpServletResponse;
/*      */ import org.apache.log4j.Logger;
/*      */ 
/*      */ public class PbPaid
/*      */ {
/*   42 */   private static final Logger logger = Logger.getLogger(PbPaid.class);
/*      */   public static final int MEMBER_FEE = 1;
/*      */   public static final int MEMBER_CHARGE = 2;
/*      */   public static final int MEMBER_SRV = 3;
/*      */   public static final int GIFT_EXCH = 4;
/*      */   public static final int BUSSBILL = 5;
/*      */   public static final int CUST_SRV = 9;
/*      */   public static final int SELL_ACCE = 19;
/*      */   public static final int GIFT_EXCH_PAY = 24;
/*      */   public static final int DEPOSIT = 25;
/*      */   public static final int POS_SALE = 26;
/*      */   public static final int INCOME = 29;
/*      */   public static final int OUTOFF_REFUND = 30;
/*      */   public static final int KEEP_CSU_BILL = 96;
/*      */   public static final int KEEP_BILL = 97;
/*      */   public static final int CUST_CASHCOUP_BILLCSPAY = 98;
/*      */   public static final int CUST_INTGR_BILLCSPAY = 99;
/*      */   public static final int CUST_INTGR_CHOUJIANG = 100;
/*      */   public static final int WECHAT_STORE_PAY = 200;
/*   86 */   private static MemberDAO memberDAO = new MemberDAO();
/*   87 */   private static ShopMemberDAO shopMemberDAO = new ShopMemberDAO();
/*      */ 
/*   89 */   private static MemberIntegralDetailDAO integralDetailDAO = new MemberIntegralDetailDAO();
/*      */ 
/*   91 */   private static MemberIntegralBillDao memberIntegralBillDao = new MemberIntegralBillDao();
/*      */ 
/*   93 */   private static MemberLogDAO memberLogDAO = new MemberLogDAO();
/*      */ 
/*   95 */   private static MemberCashCouponDetailDAO memberCashCouponDetailDAO = new MemberCashCouponDetailDAO();
/*      */ 
/*   97 */   private static MemberCashCouponBillDao memberCashCouponBillDao = new MemberCashCouponBillDao();
/*      */ 
/*   99 */   private static BussBillDao bussBillDao = new BussBillDao();
/*      */ 
/*  101 */   private static CustSMSDao cstSms = new CustSMSDao();
/*      */ 
/*  103 */   private static MemberDepositBillDAO memberDepositBillDAO = new MemberDepositBillDAO();
/*      */ 
/*  105 */   private static MemberIntegralConsumeRecordDAO integralConsumeRecordDAO = new MemberIntegralConsumeRecordDAO();
/*      */ 
/*  107 */   private static MemberCashCouponConsumeRecordDAO memberCashCouponConsumeRecordDAO = new MemberCashCouponConsumeRecordDAO();
/*      */ 
/*  109 */   private static MemberDepositConsumeRecordDAO depositConsumeRecordDAO = new MemberDepositConsumeRecordDAO();
/*      */ 
/*  113 */   private static SaleBillDao saleBillDao = new SaleBillDao();
/*      */ 
/*      */   public static int getStOfId(String ctrlName)
/*      */   {
/*   65 */     int stId = 0;
/*   66 */     if (ctrlName.equalsIgnoreCase("memberFeePay"))
/*   67 */       stId = 1;
/*   68 */     else if (ctrlName.equalsIgnoreCase("memberCharge"))
/*   69 */       stId = 2;
/*   70 */     else if (ctrlName.equalsIgnoreCase("carIncomePay"))
/*   71 */       stId = 29;
/*   72 */     else if (ctrlName.equalsIgnoreCase("saleBill"))
/*   73 */       stId = 26;
/*   74 */     else if (ctrlName.equalsIgnoreCase("depositPay"))
/*   75 */       stId = 25;
/*   76 */     else if (ctrlName.equalsIgnoreCase("giftExchPay"))
/*   77 */       stId = 4;
/*   78 */     else if (ctrlName.equalsIgnoreCase("custIntgrBillCsPay"))
/*   79 */       stId = 99;
/*   80 */     else if (ctrlName.equalsIgnoreCase("custCashCoupBillCsPay")) {
/*   81 */       stId = 98;
/*      */     }
/*   83 */     return stId;
/*      */   }
/*      */ 
/*      */   private static int insertBillPaidSavings(GsonHeadOneRow r, Double dCach, CSessionUser sessionUser, Object bissId, boolean dpan, String memo)
/*      */     throws SQLException
/*      */   {
/*  128 */     int nRstl = 0;
/*  129 */     Integer intAmt = Integer.valueOf(0);
/*  130 */     Double payCahCouPon = Double.valueOf(0.0D);
/*  131 */     Integer acceFee = (Integer)r.getValueOfName("UseAcceFee");
/*  132 */     Integer workFee = (Integer)r.getValueOfName("UseWorkFee");
/*  133 */     Double acceAmtBill = ObjectComm.objectToDouble(
/*  134 */       r.getValueOfName("AcceAmtBill"), Integer.valueOf(0));
/*  135 */     Double workAmtBill = ObjectComm.objectToDouble(
/*  136 */       r.getValueOfName("WorkAmtBill"), Integer.valueOf(0));
/*  137 */     if (((acceFee.intValue() > 0) && (acceFee != null) && (acceAmtBill.doubleValue() != 0.0D)) || ((workFee.intValue() > 0) && 
/*  138 */       (workFee != null) && (workAmtBill.doubleValue() != 0.0D))) {
/*  139 */       Long shopId = (Long)r.getValueOfName("shopId");
/*  140 */       Long memberId = (Long)r.getValueOfName("memberId");
/*  141 */       String billNo = (String)r.getValueOfName("billNo");
/*  142 */       Integer fixedIntegral = (Integer)r.getValueOfName("FixedIntegral");
/*  143 */       String conSumeType = (String)r.getValueOfName("ConsumeType");
/*  144 */       if (conSumeType.equals("鍥哄畾绉垎")) {
/*  145 */         if (dpan)
/*  146 */           intAmt = fixedIntegral;
/*      */         else
/*  148 */           payCahCouPon = Double.valueOf(fixedIntegral.doubleValue());
/*      */       }
/*      */       else {
/*  151 */         Double integralRate = ObjectComm.objectToDouble(
/*  152 */           r.getValueOfName("IntegralRate"), Integer.valueOf(0));
/*  153 */         if (dpan)
/*  154 */           intAmt = getIntegralRatioRslt(integralRate, dCach, 
/*  155 */             acceAmtBill, workAmtBill, acceFee, workFee);
/*      */         else
/*  157 */           payCahCouPon = 
/*  159 */             Double.valueOf(getIntegralRatioRslt(integralRate, dCach, 
/*  158 */             acceAmtBill, workAmtBill, acceFee, workFee)
/*  159 */             .doubleValue());
/*      */       }
/*      */       Long RuleID;
/*      */       String slName;
/*      */       String inFrom;
/*      */       Integer mberVday;
/*      */       Long billId;
/*      */       Long userId;
/*      */       String userName;
/*  162 */       if ((intAmt != null) && (intAmt.intValue() > 0)) {
/*  163 */         RuleID = (Long)r.getValueOfName("RuleID");
/*  164 */         slName = (String)r.getValueOfName("SaleName");
/*  165 */         inFrom = (String)r.getValueOfName("RuleName");
/*  166 */         mberVday = memberDAO.getVdayOfmemberId(memberId);
/*  167 */         nRstl = memberIntegralBillDao.insertBsBillInAmt(billNo, 
/*  168 */           memberId, shopId, intAmt, RuleID, inFrom, mberVday, 
/*  169 */           slName, bissId, memo);
/*  170 */         billId = memberIntegralBillDao.getLastId();
/*  171 */         nRstl = integralDetailDAO.insertBusBillDtialInAmt(memberId, 
/*  172 */           shopId, intAmt, mberVday, billId);
/*      */ 
/*  174 */         if (nRstl > 0) {
/*  175 */           nRstl = memberDAO.updateBillMemberIntAmt(memberId, intAmt);
/*  176 */           nRstl = shopMemberDAO.updateBillMemberIntAmt(memberId, 
/*  177 */             intAmt, shopId);
/*  178 */           if (sessionUser != null) {
/*  179 */             userId = Long.valueOf(sessionUser.getUserId());
/*  180 */             userName = sessionUser.getUserName();
/*  181 */             memberLogDAO.insertBusBillMbLog_IntAmt(
/*  182 */               MemberActConst.PAID, billNo, intAmt, memberId, 
/*  183 */               userId, userName);
/*  184 */             }
/*  185 */           return -9;
/*      */         }
/*      */ 
/*  188 */         return -8;
/*      */       }
/*      */ 
/*  192 */       if ((payCahCouPon != null) && (payCahCouPon.doubleValue() > 0.0D)) {
/*  193 */         label454: RuleID = (Long)r.getValueOfName("RuleID");
/*  194 */         slName = (String)r.getValueOfName("SaleName");
/*  195 */         inFrom = (String)r.getValueOfName("RuleName");
/*  196 */         mberVday = memberDAO.getVdayOfmemberId(memberId);
/*  197 */         nRstl = memberCashCouponBillDao.insertCashCoupoBill(billNo, 
/*  198 */           memberId, shopId, payCahCouPon, RuleID, inFrom, 
/*  199 */           mberVday, slName, bissId, memo);
/*  200 */         billId = memberCashCouponBillDao.getLastId();
/*  201 */         nRstl = memberCashCouponDetailDAO.insertCashCoupDtialCash(
/*  202 */           memberId, shopId, payCahCouPon, mberVday, inFrom, 
/*  203 */           billId);
/*      */ 
/*  205 */         if (nRstl > 0) {
/*  206 */           nRstl = memberDAO.updateBissBillCashConp(memberId, 
/*  207 */             payCahCouPon);
/*  208 */           nRstl = shopMemberDAO.updateBissBillCashConp(memberId, 
/*  209 */             payCahCouPon, shopId);
/*  210 */           nRstl = bussBillDao.updateBillIdOfCashAmt(bissId, 
/*  211 */             payCahCouPon);
/*  212 */           if (sessionUser != null) {
/*  213 */             userId = Long.valueOf(sessionUser.getUserId());
/*  214 */             userName = sessionUser.getUserName();
/*  215 */             memberLogDAO.insertBusBillMbLog_CashCoup(
/*  216 */               MemberActConst.PAID, billNo, payCahCouPon, 
/*  217 */               memberId, userId, userName);
/*  218 */             }
/*  219 */           return -9;
/*      */         }
/*      */ 
/*  222 */         return -7;
/*      */       }
/*      */ 
/*  227 */       if ((intAmt != null) && (intAmt.intValue() < 0)) {
/*  228 */         label659: intAmt = Integer.valueOf(0 - intAmt.intValue());
/*  229 */         GsonHeadManyRows detailIDsRslt = integralDetailDAO
/*  230 */           .getSelectMemIntDtialRslt(memberId, shopId);
/*  231 */         if ((detailIDsRslt != null) && (detailIDsRslt.getDataLength() > 0)) {
/*  232 */           Integer memberIntegral = Integer.valueOf(0);
/*  233 */           for (int i = 0; i < detailIDsRslt.getDataLength(); ++i) {
/*  234 */             Integer intAmtTemp = (Integer)detailIDsRslt
/*  235 */               .getValueOfName("Integral", i);
/*  236 */             memberIntegral = Integer.valueOf(memberIntegral.intValue() + intAmtTemp.intValue());
/*      */           }
/*  238 */           if (memberIntegral.intValue() >= intAmt.intValue()) {
/*  239 */             Integer tempIntAmt = Integer.valueOf(intAmt.intValue());
/*  240 */             boolean decIntAmt = true;
/*  241 */             for (int i = 0; i < detailIDsRslt.getDataLength(); ++i) {
/*  242 */               Integer intAmtF = (Integer)detailIDsRslt
/*  243 */                 .getValueOfName("Integral", i);
/*  244 */               Long detailId = (Long)detailIDsRslt
/*  245 */                 .getValueOfName("DetailID", i);
/*  246 */               Integer intLog = Integer.valueOf(0);
/*  247 */               if (tempIntAmt.intValue() - intAmtF.intValue() < 0) {
/*  248 */                 intLog = tempIntAmt;
/*      */               }
/*  250 */               tempIntAmt = Integer.valueOf(tempIntAmt.intValue() - intAmtF.intValue());
/*  251 */               if (!(decIntAmt)) break;
/*  252 */               if (tempIntAmt.intValue() >= 0) {
/*  253 */                 nRstl = integralDetailDAO
/*  254 */                   .updateIntAmtDtlStatusOfID(
/*  255 */                   memberId, detailId);
/*  256 */                 nRstl = integralConsumeRecordDAO
/*  257 */                   .insertIntgCrIt(detailId, billNo, 
/*  258 */                   intAmtF, bissId, memo);
/*  259 */                 if (tempIntAmt.intValue() == 0)
/*  260 */                   decIntAmt = false;
/*      */               }
/*      */               else {
/*  263 */                 intAmtF = Integer.valueOf(intAmtF.intValue() - intLog.intValue());
/*  264 */                 nRstl = integralDetailDAO
/*  265 */                   .updateIntAmtMemberIt(intAmtF, 
/*  266 */                   memberId, detailId);
/*  267 */                 nRstl = integralConsumeRecordDAO
/*  268 */                   .insertIntgCrIt(detailId, billNo, 
/*  269 */                   intLog, bissId, memo);
/*  270 */                 decIntAmt = false;
/*      */               }
/*      */ 
/*      */             }
/*      */ 
/*  276 */             Integer sum = 
/*  277 */               Integer.valueOf(integralDetailDAO
/*  277 */               .selectIntAmtTotal(memberId));
/*  278 */             nRstl = memberDAO.updateMemberIntAmt(sum, memberId);
/*  279 */             nRstl = shopMemberDAO.updateMemberIntAmt(sum, memberId, 
/*  280 */               shopId);
/*  281 */             }
/*  282 */           return -1;
/*      */         }
/*      */ 
/*  286 */         return -4;
/*      */       }
/*      */ 
/*  290 */       if ((payCahCouPon != null) && (payCahCouPon.doubleValue() < 0.0D)) {
/*  291 */         Double payCashMny = Double.valueOf(0.0D - payCahCouPon.doubleValue());
/*  292 */         GsonHeadManyRows detailIDsRslt = memberCashCouponDetailDAO
/*  293 */           .getSelectCashCouponDtialRslt(memberId, shopId);
/*  294 */         if ((detailIDsRslt != null) && (detailIDsRslt.getDataLength() > 0)) {
/*  295 */           Double memberCashCpon = Double.valueOf(0.0D);
/*  296 */           for (int i = 0; i < detailIDsRslt.getDataLength(); ++i) {
/*  297 */             Double cashCponTemp = 
/*  298 */               ObjectComm.objectToDouble(detailIDsRslt.getValueOfName(
/*  299 */               "FaceValue", i), Integer.valueOf(0));
/*  300 */             memberCashCpon = Double.valueOf(memberCashCpon.doubleValue() + cashCponTemp.doubleValue());
/*      */           }
/*  302 */           if (memberCashCpon.doubleValue() >= payCashMny.doubleValue()) {
/*  303 */             Double tempCashCpon = payCashMny;
/*  304 */             boolean decCashCpon = true;
/*  305 */             for (int i = 0; i < detailIDsRslt.getDataLength(); ++i) {
/*  306 */               Double cashCpon = ObjectComm.objectToDouble(
/*  307 */                 detailIDsRslt
/*  308 */                 .getValueOfName("FaceValue", i), Integer.valueOf(0));
/*  309 */               Long detailId = (Long)detailIDsRslt
/*  310 */                 .getValueOfName("DetailID", i);
/*  311 */               Double cashLog = Double.valueOf(0.0D);
/*  312 */               if (tempCashCpon.doubleValue() - cashCpon.doubleValue() < 0.0D) {
/*  313 */                 cashLog = tempCashCpon;
/*      */               }
/*  315 */               tempCashCpon = Double.valueOf(tempCashCpon.doubleValue() - cashCpon.doubleValue());
/*  316 */               if (!(decCashCpon)) break;
/*  317 */               if (tempCashCpon.doubleValue() >= 0.0D)
/*      */               {
/*  319 */                 nRstl = nRstl + memberCashCouponDetailDAO
/*  319 */                   .updateCashCouponDtlStatusOfID(
/*  320 */                   memberId, detailId);
/*      */ 
/*  322 */                 nRstl = nRstl + memberCashCouponConsumeRecordDAO
/*  322 */                   .insertCashConpConsum(detailId, 
/*  323 */                   billNo, cashCpon, bissId, 
/*  324 */                   memo);
/*  325 */                 if (tempCashCpon.doubleValue() == 0.0D)
/*  326 */                   decCashCpon = false;
/*      */               }
/*      */               else {
/*  329 */                 cashCpon = Double.valueOf(cashCpon.doubleValue() - cashLog.doubleValue());
/*      */ 
/*  331 */                 nRstl = nRstl + memberCashCouponDetailDAO
/*  331 */                   .updateCashCouponMemberCs(cashCpon, 
/*  332 */                   memberId, detailId);
/*      */ 
/*  334 */                 nRstl = nRstl + memberCashCouponConsumeRecordDAO
/*  334 */                   .insertCashConpConsum(detailId, 
/*  335 */                   billNo, cashLog, bissId, 
/*  336 */                   memo);
/*  337 */                 decCashCpon = false;
/*      */               }
/*      */ 
/*      */             }
/*      */ 
/*  344 */             Double sum = memberCashCouponDetailDAO
/*  345 */               .selectSqlCashCouponDtlSum(memberId);
/*  346 */             nRstl = memberDAO.updateMemberCashCoup(sum, memberId);
/*  347 */             nRstl = shopMemberDAO.updateMemberCashCoup(sum, 
/*  348 */               memberId, shopId);
/*  349 */             }
/*  350 */           return -3;
/*      */         }
/*      */ 
/*  353 */         return -6;
/*      */       }
/*      */ 
/*      */     }
/*      */ 
/*  358 */     label1428: return nRstl;
/*      */   }
/*      */ 
/*      */   private static Integer getIntegralRatioRslt(Double integralRate, Double dCach, Double acceAmtBill, Double workAmtBill, Integer acceFee, Integer workFee)
/*      */   {
/*  365 */     Integer intAmt = Integer.valueOf(0);
/*  366 */     Double rst = Double.valueOf(0.0D);
/*  367 */     Double dTotal = Double.valueOf(acceAmtBill.doubleValue() + workAmtBill.doubleValue());
/*  368 */     Double dAcceResult = Double.valueOf(dCach.doubleValue() * acceAmtBill.doubleValue() / dTotal.doubleValue());
/*  369 */     Double dWorkResult = Double.valueOf(dCach.doubleValue() * workAmtBill.doubleValue() / dTotal.doubleValue());
/*  370 */     if ((acceFee.intValue() > 0) && (workFee.intValue() > 0))
/*  371 */       rst = Double.valueOf(dAcceResult.doubleValue() * integralRate.doubleValue() + dWorkResult.doubleValue() * integralRate.doubleValue());
/*  372 */     else if (acceFee.intValue() > 0)
/*  373 */       rst = Double.valueOf(dAcceResult.doubleValue() * integralRate.doubleValue());
/*  374 */     else if (workFee.intValue() > 0) {
/*  375 */       rst = Double.valueOf(dWorkResult.doubleValue() * integralRate.doubleValue());
/*      */     }
/*  377 */     if (rst.doubleValue() != 0.0D) {
/*  378 */       intAmt = 
/*  379 */         Integer.valueOf(new BigDecimal(String.valueOf(rst)).setScale(0, 
/*  379 */         4).intValue());
/*  380 */       return intAmt;
/*      */     }
/*  382 */     return Integer.valueOf(0);
/*      */   }
/*      */ 
/*      */   private static Integer getIntegralRatioRslt(Double integralRate, Double dCach)
/*      */   {
/*  389 */     Integer intAmt = Integer.valueOf(0);
/*  390 */     Double rst = Double.valueOf(dCach.doubleValue() * integralRate.doubleValue());
/*  391 */     if (rst.doubleValue() != 0.0D) {
/*  392 */       intAmt = 
/*  393 */         Integer.valueOf(new BigDecimal(String.valueOf(rst)).setScale(0, 
/*  393 */         4).intValue());
/*  394 */       return intAmt;
/*      */     }
/*  396 */     return Integer.valueOf(0);
/*      */   }
/*      */ 
/*      */   private static int insertBillPaidSavingsNOAW(GsonHeadOneRow r, Double dCach, CSessionUser sessionUser, Object bissId, boolean dpan, String memo)
/*      */     throws SQLException
/*      */   {
/*  413 */     int nRstl = 0;
/*  414 */     Integer intAmt = Integer.valueOf(0);
/*  415 */     Double payCahCouPon = Double.valueOf(0.0D);
/*  416 */     Long shopId = (Long)r.getValueOfName("shopId");
/*  417 */     Long memberId = (Long)r.getValueOfName("memberId");
/*  418 */     String billNo = (String)r.getValueOfName("billNo");
/*  419 */     Integer fixedIntegral = (Integer)r.getValueOfName("FixedIntegral");
/*  420 */     String conSumeType = (String)r.getValueOfName("ConsumeType");
/*  421 */     if (conSumeType.equals("鍥哄畾绉垎")) {
/*  422 */       if (dpan)
/*  423 */         intAmt = fixedIntegral;
/*      */       else
/*  425 */         payCahCouPon = Double.valueOf(fixedIntegral.doubleValue());
/*      */     }
/*      */     else {
/*  428 */       Double integralRate = ObjectComm.objectToDouble(
/*  429 */         r.getValueOfName("IntegralRate"), Integer.valueOf(0));
/*  430 */       if (dpan)
/*  431 */         intAmt = getIntegralRatioRslt(integralRate, dCach);
/*      */       else
/*  433 */         payCahCouPon = 
/*  434 */           Double.valueOf(getIntegralRatioRslt(integralRate, dCach)
/*  434 */           .doubleValue());
/*      */     }
/*      */     Long RuleID;
/*      */     String slName;
/*      */     String inFrom;
/*      */     Integer mberVday;
/*      */     Long billId;
/*      */     Long userId;
/*      */     String userName;
/*  437 */     if ((intAmt != null) && (intAmt.intValue() > 0)) {
/*  438 */       RuleID = (Long)r.getValueOfName("RuleID");
/*  439 */       slName = (String)r.getValueOfName("SaleName");
/*  440 */       inFrom = (String)r.getValueOfName("RuleName");
/*  441 */       mberVday = memberDAO.getVdayOfmemberId(memberId);
/*  442 */       nRstl = memberIntegralBillDao.insertBsBillInAmt(billNo, memberId, 
/*  443 */         shopId, intAmt, RuleID, inFrom, mberVday, slName, bissId, 
/*  444 */         memo);
/*  445 */       billId = memberIntegralBillDao.getLastId();
/*  446 */       nRstl = integralDetailDAO.insertBusBillDtialInAmt(memberId, shopId, 
/*  447 */         intAmt, mberVday, billId);
/*  448 */       if (nRstl > 0) {
/*  449 */         nRstl = memberDAO.updateBillMemberIntAmt(memberId, intAmt);
/*  450 */         nRstl = shopMemberDAO.updateBillMemberIntAmt(memberId, intAmt, 
/*  451 */           shopId);
/*  452 */         nRstl = bussBillDao.updateBillIdOfAmt(bissId, intAmt);
/*  453 */         if (sessionUser != null) {
/*  454 */           userId = Long.valueOf(sessionUser.getUserId());
/*  455 */           userName = sessionUser.getUserName();
/*  456 */           memberLogDAO.insertBusBillMbLog_IntAmt(MemberActConst.PAID, 
/*  457 */             billNo, intAmt, memberId, userId, userName);
/*  458 */         }
/*  459 */         return -9;
/*      */       }
/*      */ 
/*  462 */       return -8;
/*      */     }
/*      */ 
/*  466 */     if ((payCahCouPon != null) && (payCahCouPon.doubleValue() > 0.0D)) {
/*  467 */       label351: RuleID = (Long)r.getValueOfName("RuleID");
/*  468 */       slName = (String)r.getValueOfName("SaleName");
/*  469 */       inFrom = (String)r.getValueOfName("RuleName");
/*  470 */       mberVday = memberDAO.getVdayOfmemberId(memberId);
/*  471 */       nRstl = memberCashCouponBillDao.insertCashCoupoBill(billNo, 
/*  472 */         memberId, shopId, payCahCouPon, RuleID, inFrom, mberVday, 
/*  473 */         slName, bissId, memo);
/*  474 */       billId = memberCashCouponBillDao.getLastId();
/*  475 */       nRstl = memberCashCouponDetailDAO.insertCashCoupDtialCash(memberId, 
/*  476 */         shopId, payCahCouPon, mberVday, inFrom, billId);
/*  477 */       if (nRstl > 0) {
/*  478 */         nRstl = memberDAO
/*  479 */           .updateBissBillCashConp(memberId, payCahCouPon);
/*  480 */         nRstl = shopMemberDAO.updateBissBillCashConp(memberId, 
/*  481 */           payCahCouPon, shopId);
/*  482 */         nRstl = bussBillDao.updateBillIdOfCashAmt(bissId, payCahCouPon);
/*  483 */         if (sessionUser != null) {
/*  484 */           userId = Long.valueOf(sessionUser.getUserId());
/*  485 */           userName = sessionUser.getUserName();
/*  486 */           memberLogDAO.insertBusBillMbLog_CashCoup(
/*  487 */             MemberActConst.PAID, billNo, payCahCouPon, 
/*  488 */             memberId, userId, userName);
/*  489 */          }
/*  490 */         return -9;
/*      */       }
/*      */ 
/*  493 */       return -7;
/*      */     }
/*      */ 
/*  498 */     if ((intAmt != null) && (intAmt.intValue() < 0)) {
/*  499 */       label556: intAmt = Integer.valueOf(0 - intAmt.intValue());
/*  500 */       GsonHeadManyRows detailIDsRslt = integralDetailDAO
/*  501 */         .getSelectMemIntDtialRslt(memberId, shopId);
/*  502 */       if ((detailIDsRslt != null) && (detailIDsRslt.getDataLength() > 0)) {
/*  503 */         Integer memberIntegral = Integer.valueOf(0);
/*  504 */         for (int i = 0; i < detailIDsRslt.getDataLength(); ++i) {
/*  505 */           Integer intAmtTemp = (Integer)detailIDsRslt
/*  506 */             .getValueOfName("Integral", i);
/*  507 */           memberIntegral = Integer.valueOf(memberIntegral.intValue() + intAmtTemp.intValue());
/*      */         }
/*  509 */         if (memberIntegral.intValue() >= intAmt.intValue()) {
/*  510 */           Integer tempIntAmt = Integer.valueOf(intAmt.intValue());
/*  511 */           boolean decIntAmt = true;
/*  512 */           for (int i = 0; i < detailIDsRslt.getDataLength(); ++i) {
/*  513 */             Integer intAmtF = (Integer)detailIDsRslt
/*  514 */               .getValueOfName("Integral", i);
/*  515 */             Long detailId = (Long)detailIDsRslt.getValueOfName(
/*  516 */               "DetailID", i);
/*  517 */             Integer intLog = Integer.valueOf(0);
/*  518 */             if (tempIntAmt.intValue() - intAmtF.intValue() < 0) {
/*  519 */               intLog = tempIntAmt;
/*      */             }
/*  521 */             tempIntAmt = Integer.valueOf(tempIntAmt.intValue() - intAmtF.intValue());
/*  522 */             if (!(decIntAmt)) break;
/*  523 */             if (tempIntAmt.intValue() >= 0) {
/*  524 */               nRstl = integralDetailDAO
/*  525 */                 .updateIntAmtDtlStatusOfID(memberId, 
/*  526 */                 detailId);
/*  527 */               nRstl = integralConsumeRecordDAO
/*  528 */                 .insertIntgCrIt(detailId, billNo, 
/*  529 */                 intAmtF, bissId, memo);
/*  530 */               if (tempIntAmt.intValue() == 0)
/*  531 */                 decIntAmt = false;
/*      */             }
/*      */             else {
/*  534 */               intAmtF = Integer.valueOf(intAmtF.intValue() - intLog.intValue());
/*  535 */               nRstl = integralDetailDAO.updateIntAmtMemberIt(
/*  536 */                 intAmtF, memberId, detailId);
/*  537 */               nRstl = integralConsumeRecordDAO
/*  538 */                 .insertIntgCrIt(detailId, billNo, 
/*  539 */                 intLog, bissId, memo);
/*  540 */               decIntAmt = false;
/*      */             }
/*      */ 
/*      */           }
/*      */ 
/*  546 */           Integer sum = Integer.valueOf(integralDetailDAO.selectIntAmtTotal(memberId));
/*  547 */           nRstl = memberDAO.updateMemberIntAmt(sum, memberId);
/*  548 */           nRstl = shopMemberDAO.updateMemberIntAmt(sum, memberId, 
/*  549 */             shopId);
/*  550 */           }
/*  551 */         return -1;
/*      */       }
/*      */ 
/*  555 */       return -4;
/*      */     }
/*      */ 
/*  559 */     if ((payCahCouPon != null) && (payCahCouPon.doubleValue() < 0.0D)) {
/*  560 */        Double payCashMny = Double.valueOf(0.0D - payCahCouPon.doubleValue());
/*  561 */       GsonHeadManyRows detailIDsRslt = memberCashCouponDetailDAO
/*  562 */         .getSelectCashCouponDtialRslt(memberId, shopId);
/*  563 */       if ((detailIDsRslt != null) && (detailIDsRslt.getDataLength() > 0)) {
/*  564 */         Double memberCashCpon = Double.valueOf(0.0D);
/*  565 */         for (int i = 0; i < detailIDsRslt.getDataLength(); ++i) {
/*  566 */           Double cashCponTemp = ObjectComm.objectToDouble(
/*  567 */             detailIDsRslt.getValueOfName("FaceValue", i), Integer.valueOf(0));
/*  568 */           memberCashCpon = Double.valueOf(memberCashCpon.doubleValue() + cashCponTemp.doubleValue());
/*      */         }
/*  570 */         if (memberCashCpon.doubleValue() >= payCashMny.doubleValue()) {
/*  571 */           Double tempCashCpon = payCashMny;
/*  572 */           boolean decCashCpon = true;
/*  573 */           for (int i = 0; i < detailIDsRslt.getDataLength(); ++i) {
/*  574 */             Double cashCpon = 
/*  575 */               ObjectComm.objectToDouble(detailIDsRslt.getValueOfName(
/*  576 */               "FaceValue", i), Integer.valueOf(0));
/*  577 */             Long detailId = (Long)detailIDsRslt.getValueOfName(
/*  578 */               "DetailID", i);
/*  579 */             Double cashLog = Double.valueOf(0.0D);
/*  580 */             if (tempCashCpon.doubleValue() - cashCpon.doubleValue() < 0.0D) {
/*  581 */               cashLog = tempCashCpon;
/*      */             }
/*  583 */             tempCashCpon = Double.valueOf(tempCashCpon.doubleValue() - cashCpon.doubleValue());
/*  584 */             if (!(decCashCpon)) break;
/*  585 */             if (tempCashCpon.doubleValue() >= 0.0D)
/*      */             {
/*  587 */               nRstl = nRstl + memberCashCouponDetailDAO
/*  587 */                 .updateCashCouponDtlStatusOfID(
/*  588 */                 memberId, detailId);
/*      */ 
/*  590 */               nRstl = nRstl + memberCashCouponConsumeRecordDAO
/*  590 */                 .insertCashConpConsum(detailId, billNo, 
/*  591 */                 cashCpon, bissId, memo);
/*  592 */               if (tempCashCpon.doubleValue() == 0.0D)
/*  593 */                 decCashCpon = false;
/*      */             }
/*      */             else {
/*  596 */               cashCpon = Double.valueOf(cashCpon.doubleValue() - cashLog.doubleValue());
/*      */ 
/*  598 */               nRstl = nRstl + memberCashCouponDetailDAO
/*  598 */                 .updateCashCouponMemberCs(cashCpon, 
/*  599 */                 memberId, detailId);
/*      */ 
/*  601 */               nRstl = nRstl + memberCashCouponConsumeRecordDAO
/*  601 */                 .insertCashConpConsum(detailId, billNo, 
/*  602 */                 cashLog, bissId, memo);
/*  603 */               decCashCpon = false;
/*      */             }
/*      */ 
/*      */           }
/*      */ 
/*  610 */           Double sum = memberCashCouponDetailDAO
/*  611 */             .selectSqlCashCouponDtlSum(memberId);
/*  612 */           nRstl = memberDAO.updateMemberCashCoup(sum, memberId);
/*  613 */           nRstl = shopMemberDAO.updateMemberCashCoup(sum, memberId, 
/*  614 */             shopId);
/*  615 */          }
/*  616 */         return -3;
/*      */       }
/*      */ 
/*  619 */       return -6;
/*      */     }
/*      */ 
/*  623 */     label1325: return nRstl;
/*      */   }
/*      */ 
/*      */   private static int insertSaleBillPaidSavingsNOAW(GsonHeadOneRow r, Double dCach, CSessionUser sessionUser, Object bissId, boolean dpan, String memo, SaleBillModel saleBillModel)
/*      */     throws SQLException
/*      */   {
/*  640 */     int nRstl = 0;
/*  641 */     Integer intAmt = Integer.valueOf(0);
/*  642 */     Double payCahCouPon = Double.valueOf(0.0D);
/*  643 */     Long shopId = (Long)r.getValueOfName("shopId");
/*  644 */     Long memberId = (Long)r.getValueOfName("memberId");
/*  645 */     String billNo = (String)r.getValueOfName("billNo");
/*  646 */     Integer fixedIntegral = (Integer)r.getValueOfName("FixedIntegral");
/*  647 */     String conSumeType = (String)r.getValueOfName("ConsumeType");
/*  648 */     if (conSumeType.equals("鍥哄畾绉垎")) {
/*  649 */       if (dpan)
/*  650 */         intAmt = fixedIntegral;
/*      */       else
/*  652 */         payCahCouPon = Double.valueOf(fixedIntegral.doubleValue());
/*      */     }
/*      */     else {
/*  655 */       Double integralRate = ObjectComm.objectToDouble(
/*  656 */         r.getValueOfName("IntegralRate"), Integer.valueOf(0));
/*  657 */       if (dpan) {
/*  658 */         intAmt = getIntegralRatioRslt(integralRate, dCach);
/*  659 */         saleBillModel.setIntgr(Double.valueOf(intAmt.intValue()));
/*      */       } else {
/*  661 */         payCahCouPon = 
/*  662 */           Double.valueOf(getIntegralRatioRslt(integralRate, dCach)
/*  662 */           .doubleValue());
/*  663 */         saleBillModel.setCashCoup(payCahCouPon);
/*      */       }
/*      */     }
/*      */     Long RuleID;
/*      */     String slName;
/*      */     String inFrom;
/*      */     Integer mberVday;
/*      */     Long billId;
/*      */     Long userId;
/*      */     String userName;
/*  666 */     if ((intAmt != null) && (intAmt.intValue() > 0)) {
/*  667 */       RuleID = (Long)r.getValueOfName("RuleID");
/*  668 */       slName = (String)r.getValueOfName("SaleName");
/*  669 */       inFrom = (String)r.getValueOfName("RuleName");
/*  670 */       mberVday = memberDAO.getVdayOfmemberId(memberId);
/*  671 */       nRstl = memberIntegralBillDao.insertBsBillInAmt(billNo, memberId, 
/*  672 */         shopId, intAmt, RuleID, inFrom, mberVday, slName, bissId, 
/*  673 */         memo);
/*  674 */       billId = memberIntegralBillDao.getLastId();
/*  675 */       nRstl = integralDetailDAO.insertBusBillDtialInAmt(memberId, shopId, 
/*  676 */         intAmt, mberVday, billId);
/*  677 */       if (nRstl > 0) {
/*  678 */         nRstl = memberDAO.updateBillMemberIntAmt(memberId, intAmt);
/*  679 */         nRstl = shopMemberDAO.updateBillMemberIntAmt(memberId, intAmt, 
/*  680 */           shopId);
/*  681 */         nRstl = bussBillDao.updateBillIdOfAmt(bissId, intAmt);
/*  682 */         if (sessionUser != null) {
/*  683 */           userId = Long.valueOf(sessionUser.getUserId());
/*  684 */           userName = sessionUser.getUserName();
/*  685 */           memberLogDAO.insertBusBillMbLog_IntAmt(MemberActConst.PAID, 
/*  686 */             billNo, intAmt, memberId, userId, userName);
/*  687 */           }
/*  688 */         return -9;
/*      */       }
/*      */ 
/*  691 */       return -8;
/*      */     }
/*      */ 
/*  695 */     if ((payCahCouPon != null) && (payCahCouPon.doubleValue() > 0.0D)) {
/*  696 */       label372: RuleID = (Long)r.getValueOfName("RuleID");
/*  697 */       slName = (String)r.getValueOfName("SaleName");
/*  698 */       inFrom = (String)r.getValueOfName("RuleName");
/*  699 */       mberVday = memberDAO.getVdayOfmemberId(memberId);
/*  700 */       nRstl = memberCashCouponBillDao.insertCashCoupoBill(billNo, 
/*  701 */         memberId, shopId, payCahCouPon, RuleID, inFrom, mberVday, 
/*  702 */         slName, bissId, memo);
/*  703 */       billId = memberCashCouponBillDao.getLastId();
/*  704 */       nRstl = memberCashCouponDetailDAO.insertCashCoupDtialCash(memberId, 
/*  705 */         shopId, payCahCouPon, mberVday, inFrom, billId);
/*  706 */       if (nRstl > 0) {
/*  707 */         nRstl = memberDAO
/*  708 */           .updateBissBillCashConp(memberId, payCahCouPon);
/*  709 */         nRstl = shopMemberDAO.updateBissBillCashConp(memberId, 
/*  710 */           payCahCouPon, shopId);
/*  711 */         nRstl = bussBillDao.updateBillIdOfCashAmt(bissId, payCahCouPon);
/*  712 */         if (sessionUser != null) {
/*  713 */           userId = Long.valueOf(sessionUser.getUserId());
/*  714 */           userName = sessionUser.getUserName();
/*  715 */           memberLogDAO.insertBusBillMbLog_CashCoup(
/*  716 */             MemberActConst.PAID, billNo, payCahCouPon, 
/*  717 */             memberId, userId, userName);
/*  718 */        }
/*  719 */         return -9;
/*      */       }
/*      */ 
/*  722 */       return -7;
/*      */     }
/*      */ 
/*  727 */     if ((intAmt != null) && (intAmt.intValue() < 0)) {
/*  728 */       label577: intAmt = Integer.valueOf(0 - intAmt.intValue());
/*  729 */       GsonHeadManyRows detailIDsRslt = integralDetailDAO
/*  730 */         .getSelectMemIntDtialRslt(memberId, shopId);
/*  731 */       if ((detailIDsRslt != null) && (detailIDsRslt.getDataLength() > 0)) {
/*  732 */         Integer memberIntegral = Integer.valueOf(0);
/*  733 */         for (int i = 0; i < detailIDsRslt.getDataLength(); ++i) {
/*  734 */           Integer intAmtTemp = (Integer)detailIDsRslt
/*  735 */             .getValueOfName("Integral", i);
/*  736 */           memberIntegral = Integer.valueOf(memberIntegral.intValue() + intAmtTemp.intValue());
/*      */         }
/*  738 */         if (memberIntegral.intValue() >= intAmt.intValue()) {
/*  739 */           Integer tempIntAmt = Integer.valueOf(intAmt.intValue());
/*  740 */           boolean decIntAmt = true;
/*  741 */           for (int i = 0; i < detailIDsRslt.getDataLength(); ++i) {
/*  742 */             Integer intAmtF = (Integer)detailIDsRslt
/*  743 */               .getValueOfName("Integral", i);
/*  744 */             Long detailId = (Long)detailIDsRslt.getValueOfName(
/*  745 */               "DetailID", i);
/*  746 */             Integer intLog = Integer.valueOf(0);
/*  747 */             if (tempIntAmt.intValue() - intAmtF.intValue() < 0) {
/*  748 */               intLog = tempIntAmt;
/*      */             }
/*  750 */             tempIntAmt = Integer.valueOf(tempIntAmt.intValue() - intAmtF.intValue());
/*  751 */             if (!(decIntAmt)) break;
/*  752 */             if (tempIntAmt.intValue() >= 0) {
/*  753 */               nRstl = integralDetailDAO
/*  754 */                 .updateIntAmtDtlStatusOfID(memberId, 
/*  755 */                 detailId);
/*  756 */               nRstl = integralConsumeRecordDAO
/*  757 */                 .insertIntgCrIt(detailId, billNo, 
/*  758 */                 intAmtF, bissId, memo);
/*  759 */               if (tempIntAmt.intValue() == 0)
/*  760 */                 decIntAmt = false;
/*      */             }
/*      */             else {
/*  763 */               intAmtF = Integer.valueOf(intAmtF.intValue() - intLog.intValue());
/*  764 */               nRstl = integralDetailDAO.updateIntAmtMemberIt(
/*  765 */                 intAmtF, memberId, detailId);
/*  766 */               nRstl = integralConsumeRecordDAO
/*  767 */                 .insertIntgCrIt(detailId, billNo, 
/*  768 */                 intLog, bissId, memo);
/*  769 */               decIntAmt = false;
/*      */             }
/*      */ 
/*      */           }
/*      */ 
/*  775 */           Integer sum = Integer.valueOf(integralDetailDAO.selectIntAmtTotal(memberId));
/*  776 */           nRstl = memberDAO.updateMemberIntAmt(sum, memberId);
/*  777 */           nRstl = shopMemberDAO.updateMemberIntAmt(sum, memberId, 
/*  778 */             shopId);
/*  779 */           }
/*  780 */         return -1;
/*      */       }
/*      */ 
/*  784 */       return -4;
/*      */     }
/*      */ 
/*  788 */     if ((payCahCouPon != null) && (payCahCouPon.doubleValue() < 0.0D)) {
/*  789 */       Double payCashMny = Double.valueOf(0.0D - payCahCouPon.doubleValue());
/*  790 */       GsonHeadManyRows detailIDsRslt = memberCashCouponDetailDAO
/*  791 */         .getSelectCashCouponDtialRslt(memberId, shopId);
/*  792 */       if ((detailIDsRslt != null) && (detailIDsRslt.getDataLength() > 0)) {
/*  793 */         Double memberCashCpon = Double.valueOf(0.0D);
/*  794 */         for (int i = 0; i < detailIDsRslt.getDataLength(); ++i) {
/*  795 */           Double cashCponTemp = ObjectComm.objectToDouble(
/*  796 */             detailIDsRslt.getValueOfName("FaceValue", i), Integer.valueOf(0));
/*  797 */           memberCashCpon = Double.valueOf(memberCashCpon.doubleValue() + cashCponTemp.doubleValue());
/*      */         }
/*  799 */         if (memberCashCpon.doubleValue() >= payCashMny.doubleValue()) {
/*  800 */           Double tempCashCpon = payCashMny;
/*  801 */           boolean decCashCpon = true;
/*  802 */           for (int i = 0; i < detailIDsRslt.getDataLength(); ++i) {
/*  803 */             Double cashCpon = 
/*  804 */               ObjectComm.objectToDouble(detailIDsRslt.getValueOfName(
/*  805 */               "FaceValue", i), Integer.valueOf(0));
/*  806 */             Long detailId = (Long)detailIDsRslt.getValueOfName(
/*  807 */               "DetailID", i);
/*  808 */             Double cashLog = Double.valueOf(0.0D);
/*  809 */             if (tempCashCpon.doubleValue() - cashCpon.doubleValue() < 0.0D) {
/*  810 */               cashLog = tempCashCpon;
/*      */             }
/*  812 */             tempCashCpon = Double.valueOf(tempCashCpon.doubleValue() - cashCpon.doubleValue());
/*  813 */             if (!(decCashCpon)) break;
/*  814 */             if (tempCashCpon.doubleValue() >= 0.0D)
/*      */             {
/*  816 */               nRstl = nRstl + memberCashCouponDetailDAO
/*  816 */                 .updateCashCouponDtlStatusOfID(
/*  817 */                 memberId, detailId);
/*      */ 
/*  819 */               nRstl = nRstl + memberCashCouponConsumeRecordDAO
/*  819 */                 .insertCashConpConsum(detailId, billNo, 
/*  820 */                 cashCpon, bissId, memo);
/*  821 */               if (tempCashCpon.doubleValue() == 0.0D)
/*  822 */                 decCashCpon = false;
/*      */             }
/*      */             else {
/*  825 */               cashCpon = Double.valueOf(cashCpon.doubleValue() - cashLog.doubleValue());
/*      */ 
/*  827 */               nRstl = nRstl + memberCashCouponDetailDAO
/*  827 */                 .updateCashCouponMemberCs(cashCpon, 
/*  828 */                 memberId, detailId);
/*      */ 
/*  830 */               nRstl = nRstl + memberCashCouponConsumeRecordDAO
/*  830 */                 .insertCashConpConsum(detailId, billNo, 
/*  831 */                 cashLog, bissId, memo);
/*  832 */               decCashCpon = false;
/*      */             }
/*      */ 
/*      */           }
/*      */ 
/*  839 */           Double sum = memberCashCouponDetailDAO
/*  840 */             .selectSqlCashCouponDtlSum(memberId);
/*  841 */           nRstl = memberDAO.updateMemberCashCoup(sum, memberId);
/*  842 */           nRstl = shopMemberDAO.updateMemberCashCoup(sum, memberId, 
/*  843 */             shopId);
/*  844 */           }
/*  845 */         return -3;
/*      */       }
/*      */ 
/*  848 */       return -6;
/*      */     }
/*      */ 
/*  852 */     label1346: return nRstl;
/*      */   }
/*      */ 
/*      */   public static int sendSMS(CustMessage cm) throws SQLException {
/*  856 */     int nRsult = 0;
/*  857 */     Map ss = ShopMap.listMap();
/*  858 */     ShopInfo shopList = (ShopInfo)ss.get(cm.getShopId());
/*  859 */     if (shopList != null) {
/*  860 */       Boolean paySms = shopList.getPaySms();
/*  861 */       int nState = -1;
/*  862 */       String smg = "鏃犻渶鍙戦��";
/*  863 */       String msgSig = "[" + shopList.getMsgSignature() + "]";
/*  864 */       cm.setSmsContext(CustMessage.getSmsHead(cm) + msgSig);
/*      */ 
/*  866 */       String sUrl = shopList.getMsgURL();
/*  867 */       String context = null;
/*      */       try {
/*  869 */         context = shopList
/*  870 */           .getSmsContext(cm.getMp(), cm.getSmsContext());
/*      */         try {
/*  872 */           if (paySms.booleanValue()) {
/*  873 */             String sSend = HttpUtils.post(sUrl, 
/*  874 */               context);
/*  875 */             logger.info("sendSMS");
/*  876 */             logger.info(sSend);
/*  877 */             SmsState sm = new SmsState();
/*  878 */             ParserSmsStateXml.parserSmsState(sSend, sm);
/*  879 */             nState = sm.getState();
/*  880 */             smg = sm.getMsg();
/*  881 */           }
/*  882 */           nState = -2;
/*  883 */           label299: smg = "鏃犻渶鍙戦��";
/*      */         }
/*      */         catch (IOException e) {
/*  886 */           logger.error(e.getMessage());
/*  887 */           nState = -3;
/*  888 */           smg = e.getMessage();
/*      */         }
/*      */       } catch (UnsupportedEncodingException e1) {
/*  891 */         logger.error(e1.getMessage());
/*  892 */         nState = -3;
/*  893 */         smg = e1.getMessage();
/*      */       } finally {
/*  895 */         cm.setState(Integer.valueOf(nState));
/*  896 */         cm.setMsg(smg);
/*  897 */         nRsult = cstSms.insertSms(cm);
/*      */       }
/*      */     }
/*  900 */     return nRsult;
/*      */   }
/*      */ 
/*      */   public static int sendSMS1(CustMessage cm) throws SQLException {
/*  904 */     int nRsult = 0;
/*  905 */     Map ss = ShopMap.listMap();
/*  906 */     ShopInfo shopList = (ShopInfo)ss.get(cm.getShopId());
/*  907 */     if (shopList != null) {
/*  908 */       Boolean paySms = shopList.getPaySms();
/*  909 */       int nState = -1;
/*  910 */       String smg = "鏃犻渶鍙戦��";
/*  911 */       String msgSig = "[" + shopList.getMsgSignature() + "]";
/*  912 */       cm.setSmsContext(CustMessage.getSmsHead(cm) + msgSig);
/*      */ 
/*  914 */       String sUrl = shopList.getMsgURL();
/*  915 */       String context = null;
/*      */       try {
/*  917 */         context = shopList
/*  918 */           .getSmsContext(cm.getMp(), cm.getSmsContext());
/*      */         try {
/*  920 */           if (paySms.booleanValue()) {
/*  921 */             String sSend = HttpUtils.post(sUrl, 
/*  922 */               context);
/*  923 */             logger.info("sendSMS");
/*  924 */             logger.info(sSend);
/*  925 */             SmsState sm = new SmsState();
/*  926 */             ParserSmsStateXml.parserSmsState(sSend, sm);
/*  927 */             nState = sm.getState();
/*  928 */             smg = sm.getMsg();
/*  929 */            }
/*  930 */           nState = -2;
/*  931 */           label299: smg = "鏃犻渶鍙戦��";
/*      */         }
/*      */         catch (IOException e) {
/*  934 */           logger.error(e.getMessage());
/*  935 */           nState = -3;
/*  936 */           smg = e.getMessage();
/*      */         }
/*      */       } catch (UnsupportedEncodingException e1) {
/*  939 */         logger.error(e1.getMessage());
/*  940 */         nState = -3;
/*  941 */         smg = e1.getMessage();
/*      */       } finally {
/*  943 */         cm.setState(Integer.valueOf(nState));
/*  944 */         cm.setMsg(smg);
/*  945 */         nRsult = cstSms.insertSms(cm);
/*      */       }
/*      */     }
/*  948 */     return nRsult;
/*      */   }
/*      */ 
/*      */   public static int sendApp(CustMessage cm) throws SQLException {
/*  952 */     int nRsult = 0;
/*  953 */     Map ss = ShopMap.listMap();
/*  954 */     ShopInfo shopList = (ShopInfo)ss.get(cm.getShopId());
/*  955 */     if (shopList != null) {
/*  956 */       Boolean paySms = shopList.getPaySms();
/*  957 */       int nState = -1;
/*  958 */       String smg = "鏃犻渶鍙戦��";
/*  959 */       String msgSig = "[" + shopList.getMsgSignature() + "]";
/*  960 */       cm.setSmsContext(CustMessage.getSmsHead(cm) + msgSig);
/*      */ 
/*  962 */       String sUrl = shopList.getMsgURL();
/*  963 */       String context = null;
/*      */       try {
/*  965 */         context = shopList
/*  966 */           .getSmsContext(cm.getMp(), cm.getSmsContext());
/*      */         try {
/*  968 */           if (paySms.booleanValue()) {
/*  969 */             String sSend = HttpUtils.post(sUrl, 
/*  970 */               context);
/*  971 */             logger.info("sendSMS");
/*  972 */             logger.info(sSend);
/*  973 */             SmsState sm = new SmsState();
/*  974 */             ParserSmsStateXml.parserSmsState(sSend, sm);
/*  975 */             nState = sm.getState();
/*  976 */             smg = sm.getMsg();
/*  977 */            }
/*  978 */           nState = -2;
/*  979 */           label299: smg = "鏃犻渶鍙戦��";
/*      */         }
/*      */         catch (IOException e) {
/*  982 */           logger.error(e.getMessage());
/*  983 */           nState = -3;
/*  984 */           smg = e.getMessage();
/*      */         }
/*      */       } catch (UnsupportedEncodingException e1) {
/*  987 */         logger.error(e1.getMessage());
/*  988 */         nState = -3;
/*  989 */         smg = e1.getMessage();
/*      */       } finally {
/*  991 */         cm.setState(Integer.valueOf(nState));
/*  992 */         cm.setMsg(smg);
/*  993 */         nRsult = cstSms.insertSms(cm);
/*      */       }
/*      */     }
/*  996 */     return nRsult;
/*      */   }
/*      */ 
/*      */   public static int sendTel(CustMessage cm) throws SQLException {
/* 1000 */     int nRsult = 0;
/* 1001 */     Map ss = ShopMap.listMap();
/* 1002 */     ShopInfo shopList = (ShopInfo)ss.get(cm.getShopId());
/* 1003 */     if (shopList != null) {
/* 1004 */       Boolean paySms = shopList.getPaySms();
/* 1005 */       int nState = -1;
/* 1006 */       String smg = "鏃犻渶鍙戦��";
/* 1007 */       String msgSig = "[" + shopList.getMsgSignature() + "]";
/* 1008 */       cm.setSmsContext(CustMessage.getSmsHead(cm) + msgSig);
/*      */ 
/* 1010 */       String sUrl = shopList.getMsgURL();
/* 1011 */       String context = null;
/*      */       try {
/* 1013 */         context = shopList
/* 1014 */           .getSmsContext(cm.getMp(), cm.getSmsContext());
/*      */         try {
/* 1016 */           if (paySms.booleanValue()) {
/* 1017 */             String sSend = HttpUtils.post(sUrl, 
/* 1018 */               context);
/* 1019 */             logger.info("sendSMS");
/* 1020 */             logger.info(sSend);
/* 1021 */             SmsState sm = new SmsState();
/* 1022 */             ParserSmsStateXml.parserSmsState(sSend, sm);
/* 1023 */             nState = sm.getState();
/* 1024 */             smg = sm.getMsg();
/* 1025 */            }
/* 1026 */           nState = -2;
/* 1027 */           label299: smg = "鏃犻渶鍙戦��";
/*      */         }
/*      */         catch (IOException e) {
/* 1030 */           logger.error(e.getMessage());
/* 1031 */           nState = -3;
/* 1032 */           smg = e.getMessage();
/*      */         }
/*      */       } catch (UnsupportedEncodingException e1) {
/* 1035 */         logger.error(e1.getMessage());
/* 1036 */         nState = -3;
/* 1037 */         smg = e1.getMessage();
/*      */       } finally {
/* 1039 */         cm.setState(Integer.valueOf(nState));
/* 1040 */         cm.setMsg(smg);
/* 1041 */         nRsult = cstSms.insertSms(cm);
/*      */       }
/*      */     }
/* 1044 */     return nRsult;
/*      */   }
/*      */ 
/*      */   public static int getNtiveIntegral(Object bissId, int dIntAmt, String memo) throws SQLException
/*      */   {
/* 1049 */     GsonHeadOneRow g = bussBillDao.getBillOfId(bissId);
/* 1050 */     int nResult = 0;
/* 1051 */     Long shopId = ObjectComm.objectToLong(g.getValueOfName("shopId"), Long.valueOf(0L));
/* 1052 */     Long memberId = ObjectComm.objectToLong(g.getValueOfName("memberId"), 
/* 1053 */       Long.valueOf(0L));
/* 1054 */     String billNo = (String)g.getValueOfName("billNo");
/* 1055 */     Long RuleID = ObjectComm.objectToLong(g.getValueOfName("RuleID"), Long.valueOf(0L));
/* 1056 */     String slName = (String)g.getValueOfName("SaleName");
/* 1057 */     String inFrom = (String)g.getValueOfName("RuleName");
/* 1058 */     Integer mberVday = memberDAO.getVdayOfmemberId(memberId);
/* 1059 */     Integer fInt = Integer.valueOf(0 - dIntAmt);
/* 1060 */     nResult = memberIntegralBillDao.insertBsBillInAmt(billNo, memberId, 
/* 1061 */       shopId, fInt, RuleID, inFrom, mberVday, slName, bissId, memo);
/* 1062 */     Long billId = memberIntegralBillDao.getLastId();
/* 1063 */     nResult = integralDetailDAO.insertBusBillDtialInAmt(memberId, shopId, 
/* 1064 */       fInt, mberVday, billId);
/* 1065 */     Integer sum = Integer.valueOf(integralDetailDAO.selectIntAmtTotal(memberId));
/* 1066 */     nResult = memberDAO.updateMemberIntAmt(sum, memberId);
/* 1067 */     nResult = shopMemberDAO.updateMemberIntAmt(sum, memberId, shopId);
/* 1068 */     return nResult;
/*      */   }
/*      */ 
/*      */   public static int getNtiveCashConp(Long bissId, Double payCashMny, String memo) throws SQLException
/*      */   {
/* 1073 */     GsonHeadOneRow g = bussBillDao.getBillOfId(bissId);
/* 1074 */     int nResult = 0;
/* 1075 */     Long shopId = ObjectComm.objectToLong(g.getValueOfName("shopId"), Long.valueOf(0L));
/* 1076 */     Long memberId = ObjectComm.objectToLong(g.getValueOfName("memberId"), 
/* 1077 */       Long.valueOf(0L));
/* 1078 */     String billNo = (String)g.getValueOfName("billNo");
/* 1079 */     Long RuleID = ObjectComm.objectToLong(g.getValueOfName("RuleID"), Long.valueOf(0L));
/* 1080 */     String slName = (String)g.getValueOfName("SaleName");
/* 1081 */     String inFrom = (String)g.getValueOfName("RuleName");
/* 1082 */     Integer mberVday = memberDAO.getVdayOfmemberId(memberId);
/* 1083 */     Double fDouble = Double.valueOf(0.0D - payCashMny.doubleValue());
/* 1084 */     nResult = memberCashCouponBillDao
/* 1085 */       .insertCashCoupoBill(billNo, memberId, shopId, fDouble, RuleID, 
/* 1086 */       inFrom, mberVday, slName, bissId, memo);
/* 1087 */     Long billId = memberCashCouponBillDao.getLastId();
/* 1088 */     nResult = memberCashCouponDetailDAO.insertCashCoupDtialCash(memberId, 
/* 1089 */       shopId, fDouble, mberVday, inFrom, billId);
/* 1090 */     Double sum = memberCashCouponDetailDAO
/* 1091 */       .selectSqlCashCouponDtlSum(memberId);
/* 1092 */     nResult = memberDAO.updateMemberCashCoup(sum, memberId);
/* 1093 */     nResult = shopMemberDAO.updateMemberCashCoup(sum, memberId, shopId);
/* 1094 */     return nResult;
/*      */   }
/*      */ 
/*      */   public static int getNtiveDopsit(Double dDeposit, Long memberId, String billNo, Long shopId, String userName, Long bissId, String memo)
/*      */     throws SQLException
/*      */   {
/* 1100 */     int nResult = 0;
/* 1101 */     dDeposit = Double.valueOf(0.0D - dDeposit.doubleValue());
/* 1102 */     nResult = memberDepositBillDAO.insertBsBillDpst(dDeposit, memberId, 
/* 1103 */       billNo, shopId, userName, null, memo, 1);
/* 1104 */     if (nResult > 0) {
/* 1105 */       nResult += memberDAO.updateMbBusBIllDeposit(memberId, dDeposit);
/*      */ 
/* 1107 */       nResult = nResult + shopMemberDAO
/* 1107 */         .updateMbBusBIllDeposit(memberId, dDeposit, 
/* 1107 */         shopId);
/*      */     } else {
/* 1109 */       return -10;
/*      */     }
/* 1111 */     return nResult;
/*      */   }
/*      */ 
/*      */   public static int getNtiveCash(Long memberId, Double dCach, Long shopId) throws SQLException
/*      */   {
/* 1116 */     int nRslt = memberDAO.updateMemberInc(memberId, dCach);
/* 1117 */     nRslt = shopMemberDAO.updateMemberInc(memberId, dCach, shopId);
/* 1118 */     return nRslt;
/*      */   }
/*      */ 
/*      */   public static int getGivePresent(CSessionUser sessionUser, Double dCach, Object id, Long memberId, Integer stId, Boolean isNow, String memo)
/*      */     throws SQLException
/*      */   {
/* 1124 */     int nResult = 0;
/* 1125 */     GsonHeadOneRow gg = bussBillDao.getBillIntegralOfId(id, memberId, stId);
/* 1126 */     if (gg != null) {
/* 1127 */       if (isNow.booleanValue())
/* 1128 */         nResult = insertBillPaidSavings(gg, dCach, sessionUser, id, 
/* 1129 */           true, memo);
/*      */       else {
/* 1131 */         nResult = insertBillPaidSavingsNOAW(gg, dCach, sessionUser, id, 
/* 1132 */           true, memo);
/*      */       }
/* 1134 */       if (nResult < 0) {
/* 1135 */         return nResult;
/*      */       }
/*      */     }
/*      */ 
/* 1139 */     GsonHeadOneRow qq = bussBillDao.getBillCashCouPonOfId(id, memberId, 
/* 1140 */       stId);
/* 1141 */     if (qq != null) {
/* 1142 */       if (isNow.booleanValue()) {
/* 1143 */         nResult = insertBillPaidSavings(qq, dCach, sessionUser, id, 
/* 1144 */           false, memo);
/*      */       }
/*      */       else {
/* 1147 */         nResult = nResult + 
/* 1147 */           insertBillPaidSavingsNOAW(qq, dCach, sessionUser, 
/* 1147 */           id, false, memo);
/*      */       }
/* 1149 */       if (nResult < 0) {
/* 1150 */         return nResult;
/*      */       }
/*      */     }
/* 1153 */     return nResult;
/*      */   }
/*      */ 
/*      */   public static int getGivePresentSaleBill(CSessionUser sessionUser, Double dCach, Object id, Long bussId, Long memberId, Long shopId, Integer stId, Boolean isNow, String memo, SaleBillModel saleBillModel)
/*      */     throws SQLException
/*      */   {
/* 1160 */     int nResult = 0;
/* 1161 */     GsonHeadOneRow gg = saleBillDao.getBillIntegralOfId(id, memberId, stId, 
/* 1162 */       shopId);
/* 1163 */     if (gg != null) {
/* 1164 */       if (isNow.booleanValue())
/* 1165 */         nResult = insertBillPaidSavings(gg, dCach, sessionUser, bussId, 
/* 1166 */           true, memo);
/*      */       else {
/* 1168 */         nResult = insertSaleBillPaidSavingsNOAW(gg, dCach, sessionUser, 
/* 1169 */           bussId, true, memo, saleBillModel);
/*      */       }
/* 1171 */       if (nResult < 0) {
/* 1172 */         return nResult;
/*      */       }
/*      */     }
/*      */ 
/* 1176 */     GsonHeadOneRow qq = saleBillDao.getBillCashCouPonOfId(id, memberId, 
/* 1177 */       stId, shopId);
/* 1178 */     if (qq != null) {
/* 1179 */       if (isNow.booleanValue()) {
/* 1180 */         nResult = insertBillPaidSavings(qq, dCach, sessionUser, bussId, 
/* 1181 */           false, memo);
/*      */       }
/*      */       else {
/* 1184 */         nResult = nResult + 
/* 1184 */           insertSaleBillPaidSavingsNOAW(qq, dCach, 
/* 1184 */           sessionUser, bussId, false, memo, saleBillModel);
/*      */       }
/* 1186 */       if (nResult < 0) {
/* 1187 */         return nResult;
/*      */       }
/*      */     }
/* 1190 */     return nResult;
/*      */   }
/*      */ 
/*      */   public static HttpServletResponse getResponse(int nResult, HttpServletResponse response)
/*      */   {
/* 1211 */     if (nResult == -1)
/* 1212 */       ResponseUtils.setErrorMsgResponse("绉垎涓嶅", response);
/* 1213 */     else if (nResult == -2)
/* 1214 */       ResponseUtils.setErrorMsgResponse("棰勫瓨閲戦涓嶅", response);
/* 1215 */     else if (nResult == -3)
/* 1216 */       ResponseUtils.setErrorMsgResponse("浠ｉ噾鍒搁搴︿笉澶�", response);
/* 1217 */     else if (nResult == -4)
/* 1218 */       ResponseUtils.setErrorMsgResponse("娌℃湁鎵惧埌璇ョ敤鎴峰彲鐢ㄧ殑绉垎椤�", response);
/* 1219 */     else if (nResult == -5)
/* 1220 */       ResponseUtils.setErrorMsgResponse("娌℃湁鏌ュ埌鍚堥�傜殑绉垎瑙勫垯", response);
/* 1221 */     else if (nResult == -6)
/* 1222 */       ResponseUtils.setErrorMsgResponse("娌℃湁鎵惧埌璇ョ敤鎴峰彲鐢ㄧ殑浠ｉ噾鍒搁」", response);
/* 1223 */     else if (nResult == -7)
/* 1224 */       ResponseUtils.setErrorMsgResponse("浠ｉ噾鍒稿鍔犲け璐�", response);
/* 1225 */     else if (nResult == -8)
/* 1226 */       ResponseUtils.setErrorMsgResponse("绉垎澧炲姞澶辫触", response);
/* 1227 */     else if (nResult == -10)
/* 1228 */       ResponseUtils.setErrorMsgResponse("棰勫瓨澧炲姞澶辫触", response);
/* 1229 */     else if (nResult == -11)
/* 1230 */       ResponseUtils.setErrorMsgResponse("娲楄溅娆℃暟娣诲姞澶辫触", response);
/* 1231 */     else if (nResult == -12)
/* 1232 */       ResponseUtils.setErrorMsgResponse("娲楄溅娆℃暟鎿嶄綔澶辫触,鎮ㄥ凡缁忔病鏈夊彲鐢ㄦ礂杞︽鏁�", response);
/* 1233 */     else if (nResult == -13)
/* 1234 */       ResponseUtils.setErrorMsgResponse("閲岀▼鎿嶄綔鏈夎", response);
/* 1235 */     else if (nResult == -14)
/* 1236 */       ResponseUtils.setErrorMsgResponse("鍚屾澶辫触", response);
/* 1237 */     else if (nResult == -16)
/* 1238 */       ResponseUtils.setErrorMsgResponse("浼氬憳鎵嬫満娑堟伅鎿嶄綔澶辫触", response);
/* 1239 */     else if (nResult == -17)
/* 1240 */       ResponseUtils.setErrorMsgResponse("娲楄溅娆℃暟浣撴坊鍔犺褰曞け璐�", response);
/* 1241 */     else if (nResult == -18)
/* 1242 */       ResponseUtils.setErrorMsgResponse("涓撻」鏈嶅姟娑堣垂璁板綍娣诲姞澶辫触", response);
/* 1243 */     else if (nResult == -20)
/* 1244 */       ResponseUtils.setErrorMsgResponse("姝ゆ湇鍔￠」宸插鏍�", response);
/* 1245 */     else if (nResult == -21)
/* 1246 */       ResponseUtils.setErrorMsgResponse("涓撻」鏈嶅姟娑堣垂璁板綍娣诲姞澶辫触", response);
/* 1247 */     else if (nResult == -22)
/* 1248 */       ResponseUtils.setErrorMsgResponse("浼氬憳鎵嬫満娑堟伅鎿嶄綔澶辫触", response);
/* 1249 */     else if (nResult == -88)
/* 1250 */       ResponseUtils.setErrorMsgResponse("姝ゆ湇鍔￠」娆℃暟涓嶅", response);
/* 1251 */     else if (nResult == -90)
/* 1252 */       ResponseUtils.setErrorMsgResponse("bussBill娣诲姞澶辫触", response);
/* 1253 */     else if (nResult == -91)
/* 1254 */       ResponseUtils.setErrorMsgResponse("Pos.check娣诲姞澶辫触", response);
/*      */     else {
/* 1256 */       ResponseUtils.setSqlResultResponse(nResult, "宸蹭粯娆�", response);
/*      */     }
/* 1258 */     return response;
/*      */   }
/*      */ 
/*      */   public static int getNtiveDopsitCash(Double billAmt, Long memberId, String billNo, Long shopId, String userName, String memo)
/*      */     throws SQLException
/*      */   {
/* 1264 */     int nResult = 0;
/* 1265 */     nResult = memberDepositBillDAO.insertBsBillDpst(billAmt, memberId, 
/* 1266 */       billNo, shopId, userName, null, memo, 1);
/* 1267 */     if (nResult > 0) {
/* 1268 */       nResult += memberDAO.updateMbBusBIllDeposit(memberId, billAmt);
/*      */ 
/* 1270 */       nResult = nResult + shopMemberDAO
/* 1270 */         .updateMbBusBIllDeposit(memberId, billAmt, 
/* 1270 */         shopId);
/* 1271 */       return nResult;
/*      */     }
/* 1273 */     return -10;
/*      */   }
/*      */ 
/*      */   public static int getNtiveDopsitCashNo(Double billAmt, Long memberId, String billNo, Long shopId, Long bissId, String memo)
/*      */     throws SQLException
/*      */   {
/* 1280 */     int nResult = 0;
/* 1281 */     Double doPst1 = memberDAO.getDopositOfMemberId(memberId);
/* 1282 */     billAmt = Double.valueOf(0.0D - billAmt.doubleValue());
/* 1283 */     if ((doPst1 != null) && (doPst1.doubleValue() >= billAmt.doubleValue())) {
/* 1284 */       Double dSpare = Double.valueOf(doPst1.doubleValue() - billAmt.doubleValue());
/*      */ 
/* 1286 */       nResult += memberDAO.updateDopositAmountInc(memberId, dSpare);
/*      */ 
/* 1288 */       nResult = nResult + depositConsumeRecordDAO
/* 1288 */         .insertOfDeposit(memberId, 
/* 1288 */         shopId, billNo, billAmt, bissId, memo);
/*      */ 
/* 1293 */       return nResult;
/*      */     }
/* 1295 */     return -2;
/*      */   }
/*      */ 
/*      */   public static int getPositDeposit(Double dDeposit, Long memberId, String billNo, Long shopId, Long bissId, String memo)
/*      */     throws SQLException
/*      */   {
/* 1302 */     int nResult = 0;
/*      */ 
/* 1304 */     Double doPst1 = shopMemberDAO.getDopositOfMemberId(memberId, shopId);
/* 1305 */     if ((doPst1 != null) && (doPst1.doubleValue() >= dDeposit.doubleValue())) {
/* 1306 */       Double dSpare = Double.valueOf(doPst1.doubleValue() - dDeposit.doubleValue());
/*      */ 
/* 1308 */       nResult += memberDAO.updateDopositAmountInc(memberId, dSpare);
/*      */ 
/* 1310 */       nResult = nResult + shopMemberDAO
/* 1310 */         .updateDopositAmountInc(memberId, dSpare, 
/* 1310 */         shopId);
/*      */ 
/* 1312 */       nResult = nResult + depositConsumeRecordDAO
/* 1312 */         .insertOfDeposit(memberId, 
/* 1312 */         shopId, billNo, dDeposit, bissId, memo);
/* 1313 */       return nResult;
/*      */     }
/* 1315 */     return -2;
/*      */   }
/*      */ }

/* Location:           C:\Users\Administrator\Desktop\鏂板缓鏂囦欢澶筡WEB-INF\classes\
 * Qualified Name:     com.qmsk.business.bussBill.pbPaid.PbPaid
 * JD-Core Version:    0.5.3
 */